#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int N=2e5+10;
int a[N];
ll l[N];
ll r[N];
ll gcd(ll aa,ll b)
{
	if(aa<b) swap(aa,b);
	
	return b==0?aa:gcd(b,aa%b);
}
int main()
{
	IOS;
	int n;
	cin>>n;
	
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	if(n==1 || n==2)
	{
		cout<<0;
		return 0;
	}
	
	sort(a+1,a+1+n);
	ll sum=a[n]-a[1];
	l[2]=a[2]-a[1];
	r[n-1]=a[n]-a[n-1];
	for(int i=3;i<=n-1;i++)
	{
		l[i]=gcd(l[i-1],a[i]-a[i-1]);	
    }
	for(int i=n-2;i>=1;i--)
	{
		r[i]=gcd(r[i+1],a[i+1]-a[i]);
	}
	
	ll ans=1e9+10;
	ans=min(ans,(sum-a[2]+a[1])/r[2]-n+2);
	ans=min(ans,(sum-a[n]+a[n-1])/l[n-1]-n+2);
	
	for(int i=2;i<=n-2;i++)
	{
		ans=min(ans,(sum-a[i+1]+a[i])/gcd(l[i],r[i+1])-n+2);
	}
	
	cout<<ans;

	return 0;
}
